3.3.91 \(\int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx\) [291]

Optimal. Leaf size=61 \[ \frac {B x}{b}-\frac {2 a B \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b \sqrt {a+b} d} \]

[Out]

B*x/b-2*a*B*arctan((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/b/d/(a-b)^(1/2)/(a+b)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 61, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {21, 2814, 2738, 211} \begin {gather*} \frac {B x}{b}-\frac {2 a B \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b d \sqrt {a-b} \sqrt {a+b}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(Cos[c + d*x]*(a*B + b*B*Cos[c + d*x]))/(a + b*Cos[c + d*x])^2,x]

[Out]

(B*x)/b - (2*a*B*ArcTan[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(Sqrt[a - b]*b*Sqrt[a + b]*d)

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 2738

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[2*(e/d), Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rubi steps

\begin {align*} \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx &=B \int \frac {\cos (c+d x)}{a+b \cos (c+d x)} \, dx\\ &=\frac {B x}{b}-\frac {(a B) \int \frac {1}{a+b \cos (c+d x)} \, dx}{b}\\ &=\frac {B x}{b}-\frac {(2 a B) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b d}\\ &=\frac {B x}{b}-\frac {2 a B \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b \sqrt {a+b} d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.08, size = 59, normalized size = 0.97 \begin {gather*} \frac {B \left (c+d x+\frac {2 a \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}\right )}{b d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(Cos[c + d*x]*(a*B + b*B*Cos[c + d*x]))/(a + b*Cos[c + d*x])^2,x]

[Out]

(B*(c + d*x + (2*a*ArcTanh[((a - b)*Tan[(c + d*x)/2])/Sqrt[-a^2 + b^2]])/Sqrt[-a^2 + b^2]))/(b*d)

________________________________________________________________________________________

Maple [A]
time = 0.18, size = 66, normalized size = 1.08

method result size
derivativedivides \(\frac {2 B \left (-\frac {a \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {\arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b}\right )}{d}\) \(66\)
default \(\frac {2 B \left (-\frac {a \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {\arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b}\right )}{d}\) \(66\)
risch \(\frac {B x}{b}-\frac {a B \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, d b}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) a B}{\sqrt {-a^{2}+b^{2}}\, d b}\) \(153\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

2/d*B*(-1/b*a/((a-b)*(a+b))^(1/2)*arctan(tan(1/2*d*x+1/2*c)*(a-b)/((a-b)*(a+b))^(1/2))+1/b*arctan(tan(1/2*d*x+
1/2*c)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c))^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

________________________________________________________________________________________

Fricas [A]
time = 0.43, size = 231, normalized size = 3.79 \begin {gather*} \left [-\frac {\sqrt {-a^{2} + b^{2}} B a \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - 2 \, {\left (B a^{2} - B b^{2}\right )} d x}{2 \, {\left (a^{2} b - b^{3}\right )} d}, -\frac {\sqrt {a^{2} - b^{2}} B a \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (B a^{2} - B b^{2}\right )} d x}{{\left (a^{2} b - b^{3}\right )} d}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c))^2,x, algorithm="fricas")

[Out]

[-1/2*(sqrt(-a^2 + b^2)*B*a*log((2*a*b*cos(d*x + c) + (2*a^2 - b^2)*cos(d*x + c)^2 - 2*sqrt(-a^2 + b^2)*(a*cos
(d*x + c) + b)*sin(d*x + c) - a^2 + 2*b^2)/(b^2*cos(d*x + c)^2 + 2*a*b*cos(d*x + c) + a^2)) - 2*(B*a^2 - B*b^2
)*d*x)/((a^2*b - b^3)*d), -(sqrt(a^2 - b^2)*B*a*arctan(-(a*cos(d*x + c) + b)/(sqrt(a^2 - b^2)*sin(d*x + c))) -
 (B*a^2 - B*b^2)*d*x)/((a^2*b - b^3)*d)]

________________________________________________________________________________________

Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c))**2,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 245 vs. \(2 (52) = 104\).
time = 0.46, size = 245, normalized size = 4.02 \begin {gather*} -\frac {\frac {{\left (\sqrt {a^{2} - b^{2}} B {\left (2 \, a - b\right )} {\left | a - b \right |} + \sqrt {a^{2} - b^{2}} B {\left | a - b \right |} {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {2 \, a + \sqrt {-4 \, {\left (a + b\right )} {\left (a - b\right )} + 4 \, a^{2}}}{a - b}}}\right )\right )}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} b^{2} + {\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} {\left | b \right |}} + \frac {{\left (2 \, B a - B b - B {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {2 \, a - \sqrt {-4 \, {\left (a + b\right )} {\left (a - b\right )} + 4 \, a^{2}}}{a - b}}}\right )\right )}}{b^{2} - a {\left | b \right |}}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c))^2,x, algorithm="giac")

[Out]

-((sqrt(a^2 - b^2)*B*(2*a - b)*abs(a - b) + sqrt(a^2 - b^2)*B*abs(a - b)*abs(b))*(pi*floor(1/2*(d*x + c)/pi +
1/2) + arctan(2*sqrt(1/2)*tan(1/2*d*x + 1/2*c)/sqrt((2*a + sqrt(-4*(a + b)*(a - b) + 4*a^2))/(a - b))))/((a^2
- 2*a*b + b^2)*b^2 + (a^3 - 2*a^2*b + a*b^2)*abs(b)) + (2*B*a - B*b - B*abs(b))*(pi*floor(1/2*(d*x + c)/pi + 1
/2) + arctan(2*sqrt(1/2)*tan(1/2*d*x + 1/2*c)/sqrt((2*a - sqrt(-4*(a + b)*(a - b) + 4*a^2))/(a - b))))/(b^2 -
a*abs(b)))/d

________________________________________________________________________________________

Mupad [B]
time = 0.80, size = 101, normalized size = 1.66 \begin {gather*} \frac {2\,B\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d}+\frac {2\,B\,a\,\mathrm {atanh}\left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}\right )}{b\,d\,\sqrt {b^2-a^2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(c + d*x)*(B*a + B*b*cos(c + d*x)))/(a + b*cos(c + d*x))^2,x)

[Out]

(2*B*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(b*d) + (2*B*a*atanh((a*sin(c/2 + (d*x)/2) - b*sin(c/2 + (d*
x)/2))/(cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))))/(b*d*(b^2 - a^2)^(1/2))

________________________________________________________________________________________